
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    function checkForm(){
        var number=document.getElementById("number").value;
        var dormBuildId=document.getElementById("dormBuildId").value;
        var capablePeople=document.getElementById("capablePeople").value;
        if(number==null||number==""||dormBuildId==null||dormBuildId==""||capablePeople==null||capablePeople==""){
            document.getElementById("error").innerHTML="名称不能为空！";
            return false;
        }
        return true;
    }
</script>

<script>
    $(function () {
        $.post("/dormBuild/findBuild", {}, function (data) {
            var Blis = "";
            for (var i = 0; i < data.length; i++) {
                Blis += ' <option value="' + data[i].id + '">' + data[i].name + '</option>';
            }
            $("#dormBuildId").html(Blis);
        })
    })
</script>

<div class="data_list">
    <div class="data_list_title">

        添加宿舍楼
    </div>
    <form action="${pageContext.request.contextPath}/dormBuild/addDormitory" method="post" onsubmit="return checkForm()">
        <div class="data_form" >
            <input type="hidden" id="id" name="id" value=""/>
            <table align="center">
                <tr>
                    <td><font color="red">*</font>寝室号：</td>
                    <td><input type="text" id="number"  name="number" value=""  style="margin-top:5px;height:30px;" /></td>
                </tr>
                <tr>
                    <td><font color="red">*</font>宿舍楼：</td>
                    <td>
                        <select id="dormBuildId" name="dormBuildId" onchange="findDormByBuildName()" style="width: 90px;" >
                        </select>
                    </td>
                </tr>
                <tr>
                    <td><font color="red">*</font>可容纳人数：</td>
                    <td><input type="text" id="capablePeople"  name="capablePeople" value=""  style="margin-top:5px;height:30px;" /></td>
                </tr>
            </table>
            <div align="center">
                <input type="submit" class="btn btn-primary" value="确认"/>
                &nbsp;<button class="btn btn-primary" type="button" onclick="javascript:history.back()">返回</button>
            </div>
            <div align="center">
                <font id="error" color="red">${error}</font>
            </div>
        </div>
    </form>
</div>
